<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .son1{
            height: 200px;
            width: 200px;
            background-color: red;
        }
        .son2{
            height: 200px;
            width: 200px;
            background-color: green;
            float: left;
        }
        .father{
            border: 10px solid gray;
        }

        /* 万能清除法 */
        .box::after{
            content: "xxx";
            display: block;
            clear: both;
            visibility: hidden;
            height: 0px;
        }
    </style>
</head>
<body>
    <div class="father box">
        <div class="son1"></div>
        <div class="son2"></div>

    </div>
</body>
</html>